﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using tf2hudmaker.Properties;
using tf2hudmaker.Forms;

namespace tf2hudmaker
{
    static class Program
    {
        /// <summary>
        /// Point d'entrée principal de l'application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            // Windows form properties
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Loading user's settings
            UserSettings.LoadSettings();

            // Check tf2 directory
            bool verified = DirectoryManager.CheckTf2Directory(Settings.Default._tf2path);
            Settings.Default._tf2pathverified = verified;
            UserSettings.SaveSettings();

            Console.WriteLine("Loaded TF2 path: " + Settings.Default._tf2path);
            Console.WriteLine("Checking TF2 installation: " + Settings.Default._tf2pathverified);

            //Settings.Default._tf2path = "s";
            //UserSettings.SaveSettings();
            //Console.Read();

            if (!Settings.Default._tf2pathverified)
            {
                string msg = "Your TF2 folder path hasn't been set yet or,\nis no longer correct. Would you like to set a\nnew one ?(it will be necessary to export a HUD).";
                DialogResult result = MessageBox.Show(msg, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                    new form_setdirectory().ShowDialog();
            }

            // Start the main form
            Application.Run(new form_Main());
        }
    }
}
